package com.ape.common;

import com.ape.bean.ResultData;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author dengjian
 * 全局异常捕获
 * */
@RestControllerAdvice
public class ExceptionAdaptController {

    @ExceptionHandler({RuntimeException.class})
    public ResultData runTimeException(RuntimeException exception) {
        exception.printStackTrace();
        return ResultData.error();
    }

    @ExceptionHandler({Exception.class})
    public ResultData exception(Exception exception) {
        exception.printStackTrace();
        return ResultData.error();
    }

}
